<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>汽车商城销售中心</title>
    <link rel="stylesheet" href="../../bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="../../css/style.css">
    <script src="../../jquery/jquery-3.4.1.min.js"></script>
</head>
<style>
    ::-webkit-scrollbar {display:none}
</style>
<body>
    <nav class="navbar navbar-default navbar-inverse">
        <div class="container">
            <div class="navbar-header">
                    <img src="/images/logo1.png" width="220" height="60">
            </div>
            <div class="collapse navbar-collapse navbar-left" id="navbar-collapse-1">
                    <ul class="nav navbar-nav ">
                        <li ><a href="/gotoyhFrist" target="frmMain">首页<span class="sr-only"></span></a></li>
                        <li ><a href="/gotoyhBuy" target="frmMain">汽车商城</a></li>
                        <li ><a href="/gotoyhBook" target="frmMain">预约试驾</a></li>
                        <li ><a href="/gotoyhContrast" target="frmMain">车辆对比</a></li>
                        <li ><a href="/gotoyhCalculator" target="frmMain">购车计算器</a></li>

                    </ul>
            </div>
            <div class="col-md-offset-10" style="padding-top: 20px">
                <a class= "glyphicon glyphicon-user" id="yonghu" style="color: floralwhite"></a>
                <label id="u_name" style="color: ghostwhite"></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a id="info" class= "glyphicon glyphicon glyphicon-bell" href="/gotoyhInform" target="frmMain" style="color: floralwhite"></a>
                <label id="u_info" style="color: ghostwhite"></label>&nbsp;&nbsp;&nbsp;
                <a id="shop" class= "glyphicon glyphicon-shopping-cart" href="/gotoyhShop" target="frmMain" style="color: floralwhite"></a>
                <label id="u_num" style="color: ghostwhite"></label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <br>
            </div>

        </div>
    </nav>
    <div>
        <iframe name="frmMain"  style="width:100%; height:663.2px; border: 0px" src="/gotoyhFrist"></iframe>
    </div>
</body>
<script>
    var num;
$(document).ready(function(){
        getUserInfo();


        $("#yonghu").click(function () {
            $(location).attr("href","../../index.html");
        })
        $("#u_name").click(function () {
            $(location).attr("href","../../index.html");
         })

        function getUserInfo() {
            $.ajax({
                url:"../../user/getUserInfo",
                type:"post",
                async:true,
                dataType:"json",
                success:function (result) {

                    if(result.object==null){
                        $("#u_name").text("点击登录");
                    }else {
                        var u_name = result.object.u_name;
                        sessionStorage.setItem("username",result.object.u_name)
                        $("#u_name").text(u_name);
                    }
                    sessionStorage.setItem("u_id",result.object.u_id)
                    getShopCount();

                }
            })
        }

        function getShopCount() {
            $.ajax({
                url:"../../shopcar/selectCountById",
                type:"post",
                async:true,
                dataType:"json",
                data:{
                    u_id:sessionStorage.getItem("u_id")
                },
                success:function (result) {
                    $("#u_num").text(result.errorCode);
                }
            })
        }
    });

</script>
</html>